package dbz.domain;

import java.util.Collections;
import java.util.EmptyStackException;
import java.util.List;
import java.util.Stack;

import dbz.domain.deck.expceptions.EmptyDeckException;

public class Deck {

	Stack<Card> cards;
	
	public Deck(List<Card> cards) {
		this.cards = new Stack<Card>();
		this.cards.addAll(cards);
	}
	
	public Card drawCard() throws EmptyDeckException {
		try {
		return cards.pop();
		} catch (EmptyStackException e) {
			throw new EmptyDeckException();
		}
	}
	
	public void shuffle() {
		Collections.shuffle(cards);
	}

	public Stack<Card> getCards() {
		return cards;
	}

	public void setCards(Stack<Card> cards) {
		this.cards = cards;
	}
	
}
